<!-- 
  Kuda includes a library and editor for authoring interactive 3D content for the web.
  Copyright (C) 2011 SRI International.

  This program is free software; you can redistribute it and/or modify it under the terms
  of the GNU General Public License as published by the Free Software Foundation; either 
  version 2 of the License, or (at your option) any later version.
 
  This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 
  without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
  See the GNU General Public License for more details.
 
  You should have received a copy of the GNU General Public License along with this program; 
  if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 
  Boston, MA 02110-1301 USA.
-->

<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <title>Kuda Project - %PROJECT%</title>
        <script type="text/javascript" src="%SCRIPT%/lib/jshashtable.js">
        </script>
		<script type="text/javascript" src="%SCRIPT%/o3d-webgl/base.js">
		</script>
        <script type="text/javascript" src="%SCRIPT%/o3djs/base.js">
        </script>
        <script type="text/javascript" src="%SCRIPT%/hemi/core.js">
        </script>
        <script type="text/javascript">
        	var addWinFunc = function(func, name) {
				if (typeof window[name] !== 'function') {
					window[name] = func;
				} else {
					var oldFunc = window[name];
					window[name] = function(){
						oldFunc();
						func();
					}
				}
			};
			addWinFunc(function() {
				o3djs.webgl.makeClients(function(clientElements) {
					hemi.core.init(clientElements[0]);
					hemi.core.setErrorCallback(function(msg) {
						alert('An error has occurred:\n' + msg +
							'\nDid you forget to copy a model to the assets directory?');
					});
					hemi.loader.loadPath = '%LOAD%/';
					hemi.loader.loadOctane('%PROJECT%.json');
				});
			}, 'onload');
			addWinFunc(function() {
				if (hemi.core.client) {
					hemi.core.client.cleanup();
				}
			}, 'onunload');
        </script>
    </head>
    <body>
		<div id="o3d"></div>
    </body>
</html>